export default {
  getCartList(state) {
    return state.cartList
  },
  getTotalPrice(state) {
    return state.cartList.filter(item => {
      return item.checked == true
    }).reduce((p, i) => {
      return p + i.count * i.price
    }, 0)

    // return state.cartList.reduce((p,i)=>{
    //   return p + i.count * i.price
    // },0)
  },
  getStatusOfAll(state) {
    if (state.cartList.length <= 0) return true
    return state.cartList.some(item => item.checked == false)
  }
}